import Taro, { Component } from '@tarojs/taro'
import Index from './pages/index'
import 'taro-ui/dist/style/index.scss'
import './app.scss'

// 如果需要在 h5 环境中开启 React Devtools
// 取消以下注释：
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5')  {
//   require('nerv-devtools')
// }

class App extends Component {

  componentDidMount () {}

  componentDidShow () {}

  componentDidHide () {}

  componentDidCatchError () {}

  config = {
    pages: [
      'pages/index/index',
      'pages/about/about',
      'pages/cart/cart',
      'pages/mine/mine',
    ],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#fff',
      navigationBarTitleText: 'WeChat',
      navigationBarTextStyle: 'black'
    },
    tabBar: {
      color: '#acb1b7',
      selectedColor: '#e36f3f',
      backgroundColor: '#fff',
      borderStyle: '#f985e5',
      list: [
        {
          pagePath: 'pages/index/index',
          text: '首页',
          iconPath: 'assets/tabbar/shouye.png',
          selectedIconPath: 'assets/tabbar/shouye_action.png',
        },
        {
          pagePath: 'pages/about/about',
          text: '分类',
          iconPath: 'assets/tabbar/fenlei.png',
          selectedIconPath: 'assets/tabbar/fenlei_action.png',
        },
        {
          pagePath: 'pages/cart/cart',
          text: '购物车',
          iconPath: 'assets/tabbar/cart.png',
          selectedIconPath: 'assets/tabbar/cart_action.png',
        },
        {
          pagePath: 'pages/mine/mine',
          text: '我的',
          iconPath: 'assets/tabbar/mine.png',
          selectedIconPath: 'assets/tabbar/mine_action.png',
        }
      ],
    }
  }

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Index />
    )
  }
}

Taro.render(<App />, document.getElementById('app'))
